﻿#include "NosepieceCommon/NosepieceLibLoader.h"


namespace Qly
{
NosepieceLibLoader::NosepieceLibLoader(QString dllFullName, QObject *parent)
    :QObject(parent)
{
    pNosepieceLib = new QLibrary(this);
    pNosepieceLib->setFileName(dllFullName);
    CreateInstance = (CreateInstanceType) pNosepieceLib->resolve("CreateInstance");
    Release = (ReleaseType) pNosepieceLib->resolve("Release");
}

NosepieceInterface *NosepieceLibLoader::createInstance(QObject * pObject)
{
    NosepieceInterface * p = nullptr;
    if(CreateInstance)
    {
        p = CreateInstance(pObject);
    }
    return p;
}

void NosepieceLibLoader::release(NosepieceInterface *p)
{
    if(Release)
    {
        Release(p);
    }
}
}

